package com.acme.domain.bank;

import com.acme.domain.account.Account;


public class Client {
	private Account acc;
	private Gender gender;
	private String name;
	
	public Client(Account account){
		 this.acc = account;
	}
	
	public Client(Account account,Gender gender,String name){
		 this(account);
		 this.gender = gender;
		 this.name = name;
	}
	
	public Account getAccount() {
		return acc;
	}

	public String toString(){
		return (gender.out()+" "+name+" " + acc.toString());
	}

	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		} else if (obj == null){ 
			return false;
		} else if (!(obj instanceof Client)) {
			return false;
		} else {
			final Client cl = (Client) obj;
			if (this.name != cl.getName()
					|| this.getGender() != cl.getGender()) {
				return false;
			} else {
				return true;
			}
		}
	}

	public Gender getGender() {
		return gender;
	}

	public String getName() {
		return name;
	}
	
	public int hashCode() { 
	    int hash = 1;
	    hash = hash * 31 + (this.name.toString() + this.gender.out()).hashCode();
	    return hash;
	}
}